package com.turing.post.organization.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 凭证出入库明细表实体类
 * 
 * @author wzd
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "VOUCHERSTOCKDETAIL")
@IdClass(VoucherStockDetail.class)
public class VoucherStockDetail implements Serializable {
	/**
	 * 出入库单ID
	 */
	private BigInteger IoOrderId;
	/**
	 * 发卡商No
	 */
	private String issueCompanyNo;
	/**
	 * 机构
	 */
	private String BranchNo;
	/**
	 * 交易日期
	 */
	private Date tranDate;
	/**
	 * 交易时间
	 */
	private Date TranTime;
	/**
	 * 凭证种类ID
	 */
	private BigInteger voucherId;
	/**
	 * 起始凭证号
	 */
	private String startVoucherNo;
	/**
	 * 终止凭证号
	 */
	private String endVoucherNo;
	/**
	 * 张数
	 */
	private int count;
	/**
	 * 交易类型
	 */
	private String tranType;
	/**
	 * 操作员
	 */
	private BigInteger operId;

	/**
	 * 入库
	 */
	public static final String Status_0 = "0";
	/**
	 * 调拨入库
	 */
	public static final String Status_1 = "1";
	/**
	 * 调拨出库
	 */
	public static final String Status_2 = "2";
	/**
	 * 盘盈入库
	 */
	public static final String Status_3 = "3";
	/**
	 * 业务出库
	 */
	public static final String Status_4 = "4";
	/**
	 * 作废出库
	 */
	public static final String Status_5 = "5";
	/**
	 * 丢失损坏出库
	 */
	public static final String Status_9 = "9";
	/**
	 * 入库撤销
	 */
	public static final String Status_C = "C";

	public VoucherStockDetail() {

	}

	@Id
	@Column(name = "IoOrderId", nullable = false)
	public BigInteger getIoOrderId() {
		return IoOrderId;
	}

	public void setIoOrderId(BigInteger ioOrderId) {
		IoOrderId = ioOrderId;
	}

	@Column(name = "issueCompanyNo", nullable = false)
	public String getIssueCompanyNo() {
		return issueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}

	@Id
	@Column(name = "BranchNo", nullable = false)
	public String getBranchNo() {
		return BranchNo;
	}

	public void setBranchNo(String branchNo) {
		BranchNo = branchNo;
	}
	@Id
	@Column(name = "tranDate", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Id
	@Column(name = "TranTime", nullable = false)
	public Date getTranTime() {
		return TranTime;
	}

	public void setTranTime(Date tranTime) {
		TranTime = tranTime;
	}
	@Id
	@Column(name = "voucherId", nullable = false)
	public BigInteger getVoucherId() {
		return voucherId;
	}

	public void setVoucherId(BigInteger voucherId) {
		this.voucherId = voucherId;
	}
	@Id
	@Column(name = "startVoucherNo", nullable = false)
	public String getStartVoucherNo() {
		return startVoucherNo;
	}

	public void setStartVoucherNo(String startVoucherNo) {
		this.startVoucherNo = startVoucherNo;
	}

	@Column(name = "endVoucherNo", nullable = false)
	public String getEndVoucherNo() {
		return endVoucherNo;
	}

	public void setEndVoucherNo(String endVoucherNo) {
		this.endVoucherNo = endVoucherNo;
	}

	@Column(name = "count", nullable = false)
	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	@Column(name = "tranType", nullable = false)
	public String getTranType() {
		return tranType;
	}

	public void setTranType(String tranType) {
		this.tranType = tranType;
	}

	@Column(name = "operId", nullable = false)
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getIoOrderId() == null) ? 0 : getIoOrderId().hashCode());
		result = prime * result
				+ ((getTranDate() == null) ? 0 : getTranDate().hashCode());
		result = prime * result
				+ ((getTranTime() == null) ? 0 : getTranTime().hashCode());
		result = prime * result
				+ ((getBranchNo() == null) ? 0 : getBranchNo().hashCode());
		result = prime * result
				+ ((getVoucherId() == null) ? 0 : getVoucherId().hashCode());
		result = prime
				* result
				+ ((getStartVoucherNo() == null) ? 0 : getStartVoucherNo()
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final VoucherStockDetail other = (VoucherStockDetail) obj;
		if (getIoOrderId() == null) {
			if (other.getIoOrderId() != null)
				return false;
		} else if (!getIoOrderId().equals(other.getIoOrderId()))
			return false;
		if (getTranTime() == null) {
			if (other.getTranTime() != null)
				return false;
		} else if (!getTranTime().equals(other.getTranTime()))
			return false;
		if (getTranDate() == null) {
			if (other.getTranDate() != null)
				return false;
		} else if (!getTranDate().equals(other.getTranDate()))
			return false;
		if (getBranchNo() == null) {
			if (other.getBranchNo() != null)
				return false;
		} else if (!getBranchNo().equals(other.getBranchNo()))
			return false;
		if (getVoucherId() == null) {
			if (other.getVoucherId() != null)
				return false;
		} else if (!getVoucherId().equals(other.getVoucherId()))
			return false;
		if (getStartVoucherNo() == null) {
			if (other.getStartVoucherNo() != null)
				return false;
		} else if (!getStartVoucherNo().equals(other.getStartVoucherNo()))
			return false;

		return true;
	}

}